﻿@model HomeCareLibrary.Models.PromoCodeModel
<div class="col-lg-9 col-sm-9 right_part">
    <div class="personalization-page promoCode-page">

        
        @*Header not show in case of Android App. *@
        @if (Session[HomeCareLibrary.Constants.SessionConstants.MODE] == null || Session[HomeCareLibrary.Constants.SessionConstants.MODE].ToString() == HomeCareLibrary.Constants.ApplicationModeConstants.IPHONE_APP || Session[HomeCareLibrary.Constants.SessionConstants.MODE].ToString() == HomeCareLibrary.Constants.ApplicationModeConstants.IPAD_APP)
        {
            <div class="title clearfix">
                <h1 style="text-transform: none;">Promo Code</h1>
                <div class="top-btn-per clearfix">
                    <div class="back-button" id="back-button">
                        <a href="javascript:void(0);">
                            <img src="@Url.Content("~/images/personalization-images/back-btn.png")" alt="back-btn" class="back-btn">
                            <div class="back-mob-btn"><span class="glyphicon glyphicon-chevron-left"></span>Back</div>
                        </a>
                    </div>
                </div>
            </div>
        }
         @{
                  var sessionValue = "";
                  if (Session[HomeCareLibrary.Constants.SessionConstants.MODE]!=null)
                  {
                      sessionValue = Session[HomeCareLibrary.Constants.SessionConstants.MODE].ToString();
                  }
                  else{
                      sessionValue = "";
                  }
                      <input type="hidden" value="@sessionValue" id="hdnSessionValue" />
              }
        @{var androidContent = string.Empty;
          if (Session[HomeCareLibrary.Constants.SessionConstants.MODE] == null || Session[HomeCareLibrary.Constants.SessionConstants.MODE].ToString() == HomeCareLibrary.Constants.ApplicationModeConstants.IPHONE_APP || Session[HomeCareLibrary.Constants.SessionConstants.MODE].ToString() == HomeCareLibrary.Constants.ApplicationModeConstants.IPAD_APP)
          {
              androidContent = "class= personalization-content";
          }
          else
          {
              androidContent = "";
          }
        }
         @{
   var Message="";
   if (Session[HomeCareLibrary.Constants.SessionConstants.IS_PROMO_CODE_ACTIVE]!=null)
   {
   if (TempData["getMessage"] ==null && Session[HomeCareLibrary.Constants.SessionConstants.IS_PROMO_CODE_ACTIVE].ToString()!= "foundActive")
   {
       Message = "Sorry, the Promo Code from your provider is not currently active at this time.";
   }
   else
   {
  Message="";
   }
   }
}


        <div class="main-content">
            <div @androidContent>
                <div class="personalization-bg">
                    <div class="personalization-inn">
                        <div class="personalization-data promo-per-data">
                            <br />

                            <input type="hidden" id="sponsorStatus" />
                             <form id="FormWebView" method="post" action='@Url.Action("UpdatePromocode", "Admin")' role="form">
                           
                           
                           <p style="color:red;">@Message</p>
                            
                            <img src="@Url.Content("~/images/admin/promocode.png")" alt="promocode">

                            <p class="top-data">
                                You can add or change your
                                      Promo Code here:
                            </p>

                            <div class="Dwelling-part login-form">
                                <div class="form-per">

                                   

                                        @Html.HiddenFor(m => m.user_id)
                                        @Html.HiddenFor(m => m.ChangePromocode)
                                        @Html.HiddenFor(m => m.DeletePromocode)

                                        @if (TempData["getMessage"] != string.Empty)
                                        {
                                                 
                                            <div class="update text-center">
                                                <label class="red">
                                                    @TempData["getMessage"]
                                                </label>
                                            </div>
                                                  
                                        }
                                        <div aria-hidden="true" aria-labelledby="mySmallModalLabel" role="dialog" tabindex="-1" class="modal fade bs-modal-sm" style="display: none;">
                                            <div class="modal-dialog modal-sm">
                                                <div class="modal-content">

                                                   
                                                    <div class="modal-body">
                                                        Are you sure you want to delete your Promo Code?
                                                    </div>

                                                    <div class="modal-footer">
                                                        <button data-dismiss="modal" class="btn btn-default" id="btnDeletePromo" type="button">Ok</button>
                                                        <button data-dismiss="modal" class="btn btn-default" type="button">Cancel</button>



                                                    </div>
                                                </div>
                                                <!-- /.modal-content -->
                                            </div>
                                            <!-- /.modal-dialog -->
                                        </div>

                                        <div class="form-group" style="position: relative;">
                                            <label for="promoCode">Promo Code</label>

                                            @Html.TextBoxFor(m => m.sponsor, new { @class = "form-control" })
                                            <input type="text" name="testAndroid" value="" style="height: 0; width: 0;margin-left:-2500px;"> @*display: none;*@
                                            @Html.Hidden("hdnDeletePromoCode", @Url.Action("DeletePromoCode", "Admin"))
                                            @Html.Hidden("hdnUserID", @Model.user_id)

                                            <a class="delete" style="cursor: pointer;" data-toggle="modal" data-target=".bs-modal-sm">Delete</a>


                                        </div>


                                        <br />

                                        <div class="button smallBtn">
                                            <a id="btnPromoCode" style="cursor: pointer;" class="btn-per">Submit</a>

                                        </div>

                                      

                                   

                                </div>
                            </div>
 </form>
                            <div style="word-wrap: break-word;">
                                Session Ids with values:
                      @if (ViewBag.sessionIds != string.Empty)
                      {
                          @ViewBag.sessionIds
                      }
                                <br />
                                <br />

                                <span>Session:
                    @if (ViewBag.getSession != string.Empty)
                    {
                        @ViewBag.getSession
                    }
                                </span>


                                <br />
                                <br />
                                JSON:
                   @if (ViewBag.JsonString != string.Empty)
                   {
                       <h4>@ViewBag.JsonString</h4>
                   }
                                <br />
                                <br />
                                <span style="margin-left: 10px;">Request Content-Type:
                    @if (ViewBag.ContentType != string.Empty)
                    {
                        @ViewBag.ContentType
                    }
                                </span>

                                <br />
                                <br />
                                <span style="margin-left: 10px;">Request URL:
                    @if (ViewBag.Url != string.Empty)
                    {
                        @ViewBag.Url
                    }
                                </span>

                            </div>
                           
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="wait" style="display: none; width: 100%; z-index: 999; height: 100%; position: absolute; top: 0; bottom: 0; left: 0; right: 0; padding: 2px; background-color: rgba(0, 0, 0, 0.4);">
        <div style="width: 86px; margin: 27% auto 0px;">
            <img style="" src='@Url.Content("~/images/demo_wait.gif")'  /><br>
            Loading..
        </div>
    </div>


</div>
@section script {
    @Scripts.Render("~/Scripts/BundledScriptsAdminPromoCode")
    <script src="@Url.Content("~/js/iPhone/iPhone.js")"></script>
}

<script>

    $(document).ready(function () {
        var getValue = '@Model.sponsor';
        if (getValue == '') {
            $("#sponsor").val('');
        }
    });
</script>